fix(Tooltip): improve a11y on trigger element #1437
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes NDS-701
Summary
Keyboard-only (and other assistive tech) users are able to navigate to the trigger of the tooltip element and operate it, which is good. However, the trigger element has a
role="button"
. There's no actual button action though; it only exists to create a focus/blur side effect for keyboard users.This is also an issue because every tooltip trigger is getting added to navigation landmarks, which seems wrong.
Loom video of this issue (🔉 sound on)
Changes
All
Tooltip
trigger elements should be read as focusable text content by assistive tech. The tooltip itself should be announced "politely" only when the tooltip appears.button
ARIA role from the popover trigger. It doesn't actually take an action and acts passively as it's focused, so it should not have a button role.aria-expanded
to make it clear that the announced tooltip content is in a modal toolipThe WAI-ARIA working group doesn't endorse any specific tooltip pattern officially, but this interaction pattern as implemented matches the spec for a snackbar in Material Design.